<template>
    <el-row :gutter="10">
        <el-col :span="8">
            <el-form :model="options" label-width="120px">
                <el-form-item label="播放类型">
                    <el-select v-model="options.type" class="m-2" placeholder="Select" size="large">
                        <el-option label="video/mp4" value="video/mp4" />
                        <el-option label="m3u8" value="m3u8" />
                    </el-select>
                </el-form-item>
                <el-form-item label="视频名称">
                    <el-input v-model="options.title" />
                </el-form-item>
                <el-form-item label="视频URL">
                    <el-input v-model="options.src" rows="5" type="textarea" />
                </el-form-item>
                <el-form-item label="视频封面URL">
                    <el-input v-model="options.poster" />
                </el-form-item>
                <el-form-item label="网页全屏">
                    <el-switch v-model="options.webFullScreen" />
                </el-form-item>
                <el-form-item label="快进快退">
                    <el-switch v-model="options.speed" />
                </el-form-item>
                <el-form-item label="固定播放时间">
                    <el-input v-model="options.currentTime" type="number" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">Create</el-button>
                    <el-button>Cancel</el-button>
                </el-form-item>
            </el-form>
        </el-col>
        <el-col :span="16">
                <!-- <videoPlay  
                :title="options.title" 
                :src="options.src" 
                :type="options.type" 
                :autoPlay="false"
                :webFullScreen="options.webFullScreen"
                @play="onPlay"
                @pause="onPause" 
                @timeupdate="onTimeupdate" 
                @canplay="onCanplay"  /> -->
                <videoPlay v-bind="options"></videoPlay>
            </el-col>
    </el-row>
</template>
<script setup>
import { reactive } from 'vue';
import 'vue3-video-play/dist/style.css';
import { videoPlay } from 'vue3-video-play';
const onSubmit = ()=>{
    console.log(options)
}
const options = reactive({
    title: "冰河时代",
    // src: 'http://43.138.241.64:8003/test.m3u8',
    src: "http://tch1217.top/video/test.mp4", //视频源
    type: 'video/mp4',
    // type:'m3u8',
    poster: '',
    webFullScreen: false,
    speed: true,
    currentTime: 0
});
// const onPlay = (ev) => {
//   console.log('播放')
// }
// const onPause = (ev) => {
//   console.log(ev, '暂停')
// }

// const onTimeupdate = (ev) => {
// //   console.log(ev, '时间更新')
// }
const onCanplay = (ev) => {
  console.log(ev, '可以播放')
}
</script>
<style scoped lang="scss"></style>